//
//  UIView+HDProvinceHearView.m
//  app
//
//  Created by D on 15/5/11.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HDProvinceHearView.h"
#import "HDProvinceModel.h"

@implementation  HDProvinceHearView

-(instancetype)initWithDelegate:(id)delegate section:(NSInteger)section
{
    if (self = [super init]) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 56);
        
        self.title = [[UILabel alloc]initWithFrame:CGRectOf([self.ubo fx:0 ux:24 fy:UB_1_2 uy:-16], [self.ubo uw:120 uh:32])];
        self.title.font = JKAppGlobleFontMenu;
        [self addSubview:self.title];
        
        self.rightImage = [[UIImageView alloc]initWithFrame:CGRectOf([self.ubo fx:1 ux:-60 fy:UB_1_2 uy:-8], [self.ubo uw:30 uh:16])];
        [self.rightImage setImage:[UIImage imageNamed:@"arrow_gray"]];
        [self addSubview:self.rightImage];
        
        self.mainButton = [[UIButton alloc]init];
        self.mainButton.frame = self.bounds;
        self.mainButton.tag = section;
        [self.mainButton addTarget:self action:@selector(clickHeaderView:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:self.mainButton];
        
        
    }
    return self;
}
+(instancetype)viewWihtDelegate:(id)delegate seciont:(NSInteger)section
{
    return [[self alloc] initWithDelegate:delegate section:section];
}
-(void)drawRect:(CGRect)rect
{
    [self drawSeperatorLineLeft:UF(24) right:UF(0)];
}
-(void)clickHeaderView:(UIButton*)sender
{

    
    if ([_delegate respondsToSelector:@selector(headerViewClick:inSection:)]) {
      
        [_delegate headerViewClick:self inSection:sender.tag];

    }

}

@end
